#ifndef FLEET_HH_
# define FLEET_HH_
# include "World.hh"
# include "Galaxy.hh"
# include "Player.hh"
# include "../Geom/Vector.hh"
# include <boost/noncopyable.hpp>

/**
 * \brief Flotta osztály.
 *
 * Különböző hajók összessége, amely együtt mozgatható a leglassabb tagok
 * sebességével. Megtámadhatják egymást, vagy bolygókat.
 */
class World::Fleet: boost::noncopyable {
    public: class Command;          QSP(Command);
    public: class  Noop;            QSP(Noop);
    public: class  Move;            QSP(Move);
    public: class  AttackFleet;     QSP(AttackFleet);
    public: class  AttackPlanet;    QSP(AttackPlanet);
    public: class  ColonizePlanet;  QSP(ColonizePlanet);

    public:
    static spFleet
    construct(
      u8 id,
      spPlayer owner,
      Geom::Vector<> const& position,
      u8 battleship    = 0,
      u8 fighter       = 0,
      u8 transportship = 0,
      u8 colonyship    = 0,
      u8 tank          = 0
    );

    /// \brief A példány zárolására szolgáló mutex.
    protected: mutable QMutex lock;

    /// \brief Játékosonként egyedi azonosító.
    public: u8 const id;

    /// \brief A flotta tulajdonosa, az irányító játékos.
    protected: wpPlayer const owner;

    /// \brief A flotta aktuális parancsa.
    protected: spCommand command;

    /// \brief A flotta aktuális helye.
    protected: Geom::Vector<> position;

    /// \brief Csatahajók száma.
    protected: u8 battleship;

    /// \brief Vadászok száma.
    protected: u8 fighter;

    ///\brief Csapatszállítók száma.
    protected: u8 transportship;

    /// \brief Kolonizáló hajók száma.
    protected: u8 colonyship;

    /// \brief Tankok száma.
    protected: u8 tank;

    protected: Fleet(
      u8 id, spPlayer owner, Geom::Vector<> const& position,
      u8 battleship, u8 fighter, u8 transportship, u8 colonyship, u8 tank
    );
    protected: spFleet self() const;
    public: void destruct();
    public: void next_turn();
    protected: void move_towards(Geom::Vector<> const& destination);
    public: void attack(spFleet attacker);
    protected: u8 max_tanks() const;
    public: double get_speed() const;
    public: void set_command(Command* newCommand);
    public: void set_command(spCommand newCommand);
    public: spPlayer       get_owner()    const;
    public: spCommand      get_command()  const;
    public: Geom::Vector<> get_position() const;
    public: u8   get_battleship()    const;
    public: u8   get_fighter()       const;
    public: u8   get_transportship() const;
    public: u8   get_colonyship()    const;
    public: u8   get_tank()          const;
    public: void add_battleship(i8 value);
    public: void add_fighter(i8 value);
    public: void add_transportship(i8 value);
    public: void add_colonyship(i8 value);
    public: void add_tank(i8 value);
};

# include "Fleet/Command.hh"

#endif // ndef FLEET_HH_
